package com.wx.service;

import com.wx.domain.dto.SysPatientFollowDto;
import com.wx.domain.vo.PatientFollowDetailVo;
import com.wx.mapper.SysPatientFollowMapper;

import java.util.List;
import java.util.concurrent.Callable;

public class TaskThreadQuery implements Callable<List<PatientFollowDetailVo>> {

    private final SysPatientFollowMapper sysPatientFollowMapper;
    private final SysPatientFollowDto sysPatientFollowDto;

    private final int offset;
    private final int rows;

    public TaskThreadQuery(SysPatientFollowMapper sysPatientFollowMapper, SysPatientFollowDto sysPatientFollowDto, int offset, int rows) {
        this.sysPatientFollowMapper = sysPatientFollowMapper;
        this.offset = offset;
        this.rows = rows;
        this.sysPatientFollowDto = sysPatientFollowDto;
    }

    @Override
    public List<PatientFollowDetailVo> call() throws Exception {
        List<PatientFollowDetailVo> list = sysPatientFollowMapper.queryAllByPage(offset, rows, sysPatientFollowDto);
        if (list != null && list.size() > 0) {
            return list;
        }
        return null;
    }
}